package com.example.mrzhou.lvmm.presenter.tm;

import com.example.mrzhou.lvmm.entity.tm.TM;
import com.example.mrzhou.lvmm.model.ModelFactory;
import com.example.mrzhou.lvmm.view.impl.tm.TMView;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Mr.zhou on 2016/10/29.
 */

public class TMPresenter {

    private TMView tmView;

    public TMPresenter(TMView tmView) {
        this.tmView = tmView;
    }

    //    public void getTMData(Map<String,String> map, Map<String,String> params){
//        ModelFactory.getITMModel().getTMData(map, params, new Subscriber<TM>() {
//            @Override
//            public void onCompleted() {
//                tmView.onFinsh();
//            }
//
//            @Override
//            public void onError(Throwable e) {
//                tmView.onFaiure(e);
//            }
//
//            @Override
//            public void onNext(TM tm) {
//                tmView.onSuccess(tm);
//            }
//        });
//    }
    public void getTMData(Map<String, String> map) {
        ModelFactory.getITMModel().getTMData(map, new Subscriber<TM>() {
            @Override
            public void onCompleted() {
                tmView.onFinsh();
            }

            @Override
            public void onError(Throwable e) {
                tmView.onFaiure(e);
            }

            @Override
            public void onNext(TM tm) {
                tmView.onSuccess(tm);
            }
        });
    }

}
